package de.baumann.browser.present

import de.baumann.browser.api.OdinObserver
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.ICreatePoolView
import de.baumann.browser.model.PoolModel

class CreatePoolPresenter : BasePresenter<ICreatePoolView>() {

    private val poolModel = PoolModel()

    fun getSmsCode(token:String) {
        this.poolModel.createPoolGetSmsCode(view.telNum,token)
                .subscribe(object : OdinObserver<Any>(view) {
                    override fun onSuccess(data: Any?) {

                    }
                })
    }


    fun createPool() {
        this.poolModel.createPool(view.telNum, view.smsCode)
                .subscribe(object : OdinObserver<Any>(view) {
                    override fun onSuccess(data: Any?) {
                        if (view != null)
                            view.createPoolSuccess()
                    }
                })
    }

}